<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>																			
<%@ include file="/WEB-INF/view/jsp/base.jsp" %>																																			
<html lang="en">																																											
<body class="wysihtml5-supported">																																							
	<div id="content">																																										
		<div class="container-fluid">																																							
			<div class="row-fluid">																																							
				<div class="span6">																																							
					<div class="widget-box">																																					
						<div class="widget-title">																																			
							<h5>详情</h5>																																							
						</div>																																									
						<div class="widget-content nopadding">																																
							<form id="employeeForm" action="" method="post" class="form-horizontal">																					
								<input type="hidden" name=id />																																
								<div class="control-group">																																
									<label class="control-label">员工编号 :</label>																								
									<div class="controls">																																
										<span class="span11" name="id" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">员工姓名 :</label>																								
									<div class="controls">																																
										<span class="span11" name="empName" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">职位 :</label>																								
									<div class="controls">																																
										<span class="span11" name="job" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">出生日期 :</label>																								
									<div class="controls">																																
										<span class="span11" name="birthday" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">主管编号 :</label>																								
									<div class="controls">																																
										<span class="span11" name="mgr" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">录用日期 :</label>																								
									<div class="controls">																																
										<span class="span11" name="hiredata" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">薪水 :</label>																								
									<div class="controls">																																
										<span class="span11" name="salary" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">部门编号 :</label>																								
									<div class="controls">																																
										<span class="span11" name="depton" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">数据创建日期 :</label>																								
									<div class="controls">																																
										<span class="span11" name="createData" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="control-group">																																
									<label class="control-label">数据修改日期 :</label>																								
									<div class="controls">																																
										<span class="span11" name="updateDate" ></span>																							
									</div>																																					
								</div>	    																																				
								<div class="form-actions">																																	
									<button type="button" class="btn btn-success" style="float:right;margin-left:10px;"  onclick="del($(this))">删除</button>								
									<button type="button" class="btn btn-success" style="float:right;margin-left:10px;"  onclick="edit($(this))">修改</button>							
								</div>																																							
							</form>																																								
						</div>																																									
					</div>																																										
				</div>																																											
			</div>																																												
		</div>																																													
	</div>																																														
	<script>																																													
	    var params = C.getParams("${param}");   //接收传来的参数																																												
		//初始化表单数据																																												
		$(document).ready(function(){																																							
																																																
			if(!$.isEmptyObject(params)){																																						
				$.ajax({																																										
					url:"<%=path%>/employee/get",																																			
				    data:params,																																			
				    type:"post",																																								
				    success:function(text){																																						
				    	if(text.success){																																						
							$("#employeeForm").autofill(text.data);   //填充隐藏表单																												
				    		var _data = text.data ;																																				
					    	$("#employeeForm").find("span").each(function(){																												
					    		_this = $(this) ;																																				
					    		_name = _this.attr("name") ;																																	
					    		if(_name!=null){																																				
					    			for(key in _data){																																			
					    				if(_name == key){																																		
					    					_this.html(_data[key]);																																
					    				}																																						
					    			}																																							
					    		}																																								
					        });																																									
				    	}else{																																									
				    		//查询无结果时返回原查询页面，并返回标识result=null表示无查询结果																														
				    		window.location.href="<%=path%>/employee/query?result=null";																										
				    	}																																										
				    }																																											
				});																																												
			}																																													
		});																																														
	    	//编辑																																													
			function edit(_this){																																									
             $("#employeeForm").attr("action","<%=path%>/employee/form");																												
			    $("#employeeForm").submit();	    																																			
 		}   																																												
 		//删除																																												
 		function del(_this){																																								
 			if(confirm("确认删除？")){																																						
				$("#employeeForm").attr("action","<%=path%>/employee/form");																												
    			$.ajax({																																										
     				url:"<%=path %>/employee/del",																																		
     				data:$("#employeeForm").serialize(),																																					
     				type:"post",																																							
     				success:function(text){																																					
     					if(text.success){																																					
     						alert("删除成功！");																																				
     						history.go(-1);																																					
     					}else{																																								
     						alert("删除失败！");																																				
     					}																																									
     				}																																										
     			});																																											
 			}																																												
 		}																																													
	</script>																																													
</body>																																														
</html>	    																																												

